{template cashier_header}
<script>
    $(function(){
        $(".key").blur(function(){
            var key = $(this).val();
            var url = "{php echo $this->createMobileUrl('cashier',array('op' => 'get_member'))}";
            $.ajax({
                type : "post",
                url : url,
                data : {'key' : key},
                success : function(data){
                    if(data == 111){
                        alert("找不到对应客户，请确认！");
                    }else{
                        $("#change_member").html(data);
                    }
                }
            });
        });
        $(".change").click(function(){
            var member_id = $("#change_member").val();
            var goods_id = "{$goods_id}";
            if(member_id == 0){
                alert('请选择客户');
            }else{
                var url = "{php echo $this->createMobileUrl('cashier',array('op' => 'change_member_id'))}";
                $.ajax({
                    type : 'post',
                    url : url,
                    data : {'member_id' : member_id, 'goods_id' : goods_id},
                    success : function(data){
                        if(data == 111){
                            location.href="{php echo $this->createMobileUrl('cashier')}";
                        }else{
                            alert(data);
                        }
                    }
                });
            }
        });
    });
</script>
<div style="padding:0px 10px 0px 10px;">
    <div class="panel panel-primary">
        <div class="panel-body">
            <table class="table">
                <tr>
                    <th>商品</th>
                    <th>运费</th>
                    <th>代付款</th>
                </tr>
                <tr>
                    <td>大米10袋</td>
                    <td>100</td>
                    <td>300</td>
                </tr>
                <tr>
                    <td colspan="3" >
                        原收款客户：{$member['name']}
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <input type="text" class="form-control key" placeholder="请输入变更客户名/助记码/手机号码" />
                    </td>
                </tr>
                <tr>
                    <td colspan="3" align="right">
                        <select class="form-control" id="change_member">
                            <option value="0">请选择变更的客户</option>
                        </select>
                    </td>
                </tr>
            </table>
            <button class="btn btn-success change" >确定变更</button>
            <a href="{php echo $this->createMobileUrl('cashier')}">
                <button class="btn btn-danger">取消</button>
            </a>
        </div>
    </div>
</div>

{template 'footer'}